
#include <iostream>
#include <unistd.h>    //sleep和getpid需要
#include <sys/types.h> //系统调用需要
#include <signal.h>
#include <string>
#include <cstdio>
#include <cstring>

using std::cin;
using std::cout;
using std::endl;

void Usag(const std::string& process)
{
    cout << "\nUsag : " << process << " pid signo\n"<< endl;
}
int main(int argc, char *argv[], char *envp[])
{
    if(argc != 3)
    {
        Usag(argv[0]);
        exit(1);
    }
    for(int i=0;i<argc;++i)
    {
        printf("argv[%d] : %s\n",i,argv[i]);
    }
    pid_t id = atoi(argv[1]);
    int signal = atoi(argv[2]);
    int ret = kill(id,signal);
    if(ret!=0)
    {
        cout << "errno : " << errno << "  " << strerror(errno) << endl;
    }
    return 0;
}